﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BanHangCshap.Class.gkhtdl63.DAL
{
    public abstract class QCBoSanphamDAL:clsBaseDAL
    {
        public DataTable QCBoSanpham_LayDanhsach()
        {
            return base.Select("sp_QCBoSanpham_LayDanhsach");
        }

        public DataTable QCBoSanpham_LayTheoMa(string xlMa)
        {
            string xlSPName = "sp_QCBoSanpham_LayTheoMa";
            string[] xlSPPara = { "@Ma" };
            string[] xlSPValu = { xlMa };
            return base.Select(xlSPName, xlSPPara, xlSPValu);
        }

        public DataTable QCBoSanpham_LayTheoMa_BoSanpham(string xlMa_BoSanpham)
        {
            string xlSPName = "sp_QCBoSanpham_LayTheoMa_BoSanpham";
            string[] xlSPPara = { "@Ma_BoSanpham" };
            string[] xlSPValu = { xlMa_BoSanpham };
            return base.Select(xlSPName, xlSPPara, xlSPValu);
        }

        public bool QCBoSanpham_Them(DAL.Entities.QCBoSanpham xlQCBSP)
        {
            string xlSPName = "sp_QCBoSanpham_Them";
            string[] xlSPPara = {  
                                    "@Ma"
                                    ,"@Ma_BoSanpham"
                                    ,"@Ten"
                                    ,"@Mota"
                                    ,"@MaNguoidung"
                                    ,"@Ngaytao"
                                    ,"@Giagoc"
                                    ,"@Giaxuat"
                                    ,"@Ghichu"
                                    ,"@Hiendung"
                                    ,"@Ma_DieukienBaohanh"
                                    ,"@ThoigianBaohanh"
                                };

            object[] xlSPValu = {   
                                    xlQCBSP.Ma
                                    ,xlQCBSP.Ma_BoSanpham
                                    ,xlQCBSP.Ten
                                    ,xlQCBSP.Mota
                                    ,xlQCBSP.MaNguoidung
                                    ,xlQCBSP.Ngaytao
                                    ,xlQCBSP.Giagoc
                                    ,xlQCBSP.Giaxuat
                                    ,xlQCBSP.Ghichu
                                    ,xlQCBSP.Hiendung
                                    ,xlQCBSP.Ma_DieukienBaohanh
                                    ,xlQCBSP.ThoigianBaohanh

                                 };
            return base.Insert(xlSPName, xlSPPara, xlSPValu);
        }

        public bool QCBoSanpham_Capnhat(DAL.Entities.QCBoSanpham xlQCBSP, string Macu)
        {
            string xlSPName = "sp_QCBoSanpham_Capnhat";
            string[] xlSPPara = {  
                                    "@Macu"                        
                                    ,"@Ma"
                                    ,"@Ma_BoSanpham"
                                    ,"@Ten"
                                    ,"@Mota"
                                    ,"@MaNguoidung"
                                    ,"@Ngaytao"
                                    ,"@Giagoc"
                                    ,"@Giaxuat"
                                    ,"@Ghichu"
                                    ,"@Hiendung"
                                    ,"@Ma_DieukienBaohanh"
                                    ,"@ThoigianBaohanh"
                                };

            object[] xlSPValu = {   
                                    Macu                        
                                    ,xlQCBSP.Ma
                                    ,xlQCBSP.Ma_BoSanpham
                                    ,xlQCBSP.Ten
                                    ,xlQCBSP.Mota
                                    ,xlQCBSP.MaNguoidung
                                    ,xlQCBSP.Ngaytao
                                    ,xlQCBSP.Giagoc
                                    ,xlQCBSP.Giaxuat
                                    ,xlQCBSP.Ghichu
                                    ,xlQCBSP.Hiendung
                                    ,xlQCBSP.Ma_DieukienBaohanh
                                    ,xlQCBSP.ThoigianBaohanh

                                 };
            return base.Update(xlSPName, xlSPPara, xlSPValu);
        }

        public bool QCBoSanpham_Xoa(string Ma)
        {
            string xlSPName = "sp_QCBoSanpham_Xoa";
            string[] xlSPPara = {"@Ma"};
            object[] xlSPValu = {Ma};
            return base.Update(xlSPName, xlSPPara, xlSPValu);
        }

    }
}
